#include "EntityDecor.h"
#include "Visualisation.h"
#include "WorldModel.h"
CEntityDecor::CEntityDecor(int gfxIndex, D3DXVECTOR3 initialPosition, float initialPitch, float initialYaw, float initialRoll, bool collision, float offsetY):
							CWorldEntity(), m_offsetY(offsetY)
{
	m_gfxIndex=gfxIndex;
	m_position=initialPosition;
	m_pitch=initialPitch;
	m_yaw=initialYaw;
	m_roll=initialRoll;
	m_detectCollision=collision;
	if(collision)
	{
		calculBoundingBox();
		calculOBBBoundingBox();
		calculBoundingBoxIntoWorldSpace();
	}

	m_collisionCost=0;
}

CEntityDecor::~CEntityDecor(void){}

void CEntityDecor::doUpdate(void)
{
	m_position.y=WORLDMODEL->terrainFollowing(&m_position);
	m_position.y+=m_offsetY;
	calculBoundingBoxIntoWorldSpace();
}

void CEntityDecor::doRender(void)
{
	VIS->displayModel(m_gfxIndex, m_position, m_pitch, m_yaw, m_roll);
}